﻿using Shop.RemoteModel.Advert;
using Shop.RemoteModel.Advert.Model;
using Shop.StoreGatewayModular.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.HttpApiGateway.Model;

namespace Shop.StoreGatewayModular.Service
{
    internal class AdvertService : IAdvertService
    {
        public long Add (AdvertAdd add)
        {
            return new AddAdvert
            {
                Datum = add
            }.Send();
        }
        public bool Set (long id, AdvertSet set)
        {
            return new SetAdvert
            {
                Id = id,
                Datum = set
            }.Send();
        }
        public PagingResult<AdvertBase> Query (PagingParam<AdvertQueryParam> param)
        {
            return new QueryAdvert
            {
                Index = param.Index,
                Size = param.Size,
                SortName = param.SortName,
                IsDesc = param.IsDesc,
                NextId = param.NextId,
                Query = param.Query
            }.Send();
        }
        public void Delete (long id)
        {
            new DeleteAdvert
            {
                Id = id
            }.Send();
        }
        public void Enable (long id)
        {
            new EnableAdvert
            {
                Id = id
            }.Send();
        }
        public void Stop (long id)
        {
            new StopAdvert
            {
                Id = id
            }.Send();
        }
        public AdvertDto Get (long id)
        {
            return new GetAdvert
            {
                Id = id
            }.Send();
        }

        public void End (long id)
        {
            new EndAdvert
            {
                Id = id
            }.Send();
        }
    }
}
